export function getCookie(name: string): string | null {
  const cookies = document.cookie.split('; ');
  for (const cookie of cookies) {
    const [key, value] = cookie.split('=');
    if (key === name) {
      return decodeURIComponent(value);
    }
  }
  return null;
}
export function setCookie(name: string, value: string, days: number): void {
  const expires = new Date(Date.now() + days * 864e5).toUTCString();
  document.cookie = `${name}=${encodeURIComponent(value)}; expires=${expires}; path=/`;
}
export function deleteCookie(name: string): void {
  document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
}
export function getQueryParam(name: string): string | null {
  const urlParams = new URLSearchParams(window.location.search);
  return urlParams.get(name);
}
export function setQueryParam(name: string, value: string): void {
  const url = new URL(window.location.href);
  url.searchParams.set(name, value);
  window.history.pushState({}, '', url.toString());
}
export function deleteQueryParam(name: string): void {
  const url = new URL(window.location.href);
  url.searchParams.delete(name);
  window.history.pushState({}, '', url.toString());
}
export function getLocalStorageItem(key: string): string | null {
  return localStorage.getItem(key);
}
export function setLocalStorageItem(key: string, value: string): void {
  localStorage.setItem(key, value);
}
export function deleteLocalStorageItem(key: string): void {
  localStorage.removeItem(key);
}
export function getSessionStorageItem(key: string): string | null {
  return sessionStorage.getItem(key);
}
export function setSessionStorageItem(key: string, value: string): void {
  sessionStorage.setItem(key, value);
}
export function deleteSessionStorageItem(key: string): void {
  sessionStorage.removeItem(key);
}   